package com.dongchedi.utils.constant;

import java.time.LocalDate;

/**
 * @author leibidong
 * @description  redis的常量key
 * @date 2021/6/29
 */
public class RedisConstantKey {
    private final static  String HOTSALE="hotSaleProduct";
    private static final String SPLIT = ":";
    private final  static String PRODUCT="product";
    private final static  String PRODUCTCATEGORY="productCategory";
    private final static  String CUSTOMERADDRESS="customerAddress";
    private final  static  String PERSONINFO="personInfo";
    private final static String ORDERDETAIL="orderDetail";
    private final static String  LOGIN="login";
    private final static String LOGINID="loginId";
    public static String getHotsaleKey(LocalDate localDate) {
        return HOTSALE + SPLIT +localDate;
    }
    public static String getProductKey(Integer customerId,Integer id) {
        return PRODUCT + SPLIT +customerId+SPLIT+id;
    }
    public static String getProductCategoryKey(String firstCategoryName) {
        return PRODUCTCATEGORY+ SPLIT +firstCategoryName;
    }
    public  static String getProductByFirstLevel(String categoryName, Integer firstCategoryLevel){
        return PRODUCTCATEGORY+ SPLIT +categoryName+SPLIT+firstCategoryLevel;
    }
    public static String getAllAddress(Integer customerId){
        return CUSTOMERADDRESS+SPLIT+customerId;
    }
    public static String getPersonInfo(Integer customerId){
        return PERSONINFO+SPLIT+customerId;
    }
    public static  String getOrderdetail(Integer customerId, Integer orderId){
        return ORDERDETAIL+SPLIT+customerId+SPLIT+orderId;
    }
    public static String getLoginRedisKey(String ticket){
        return LOGIN+SPLIT+ticket;
    }
    public static String getRedisByLoginid(Integer id){
        return  LOGINID+SPLIT+id;
    }
}
